/*class Student{
    String name;
    int age;
    String sex;
    void read(){
        System.out.println("大家好，我是："+name+"今年"+age+"岁"+"，我在看书！"+sex);
    }
}
class Dog{
    String name;
    int age;
    String color;
    public void bark(){
        System.out.println(name+"汪汪叫~~");
    }
    public void age(){
        System.out.println(age+"岁");
    }
    public void color(){
        System.out.println("颜色"+color);
    }
    public void wag(){
        System.out.println(name+"摇尾巴~~");
    }
}
public class Test{
    public static void main1(String[] args) {
        Student student = new Student();
        student.name = "小华";
        student.read();
    }

    public static void main2(String[] args) {
        Student student1 = new Student();
        Student student2 = new Student();
        student1.name = "陈笛";
        student1.age = 18;
        student1.sex = "男";
        student1.read();
        student2.name = "小花";
        student2.age = 18;
        student2.sex = "女";
        student2.read();
    }

    public static void main3(String[] args) {
        Student stu1 = new Student();//stu实列化，在函数栈中分配空间
        Student stu2 = null;
        stu1.name = "龙哈哈";
        stu1.age = 18;
        stu1.sex = "女";
        stu2 = stu1;//此时stu2并没有实列化，而是将Stu1中的堆内存空间的使用权分配给了stu2
        stu2.age = 50;//stu2可以更改stu1堆空间上的内容
        stu1.read();
        stu2.read();
    }

    public static void main4(String[] args) {
        Dog dog1 = new Dog();
        Dog dog2 = new Dog();
        dog1.name = "旺财";
        dog1.age = 5;
        dog1.color = "黑色";
        dog2.name = "赛虎";
        dog2.age = 3;
        dog2.color = "灰色";
        dog1.bark();
        dog1.color();
        dog1.age();
        dog1.wag();
    }
}*/



class Student{
    String name;
    int age;
    public void doClass(){
        System.out.println(this.name+"上课");
    }
    public void print(){
        System.out.println(this.name+"正在上课"+this.age);
    }
    public Student(){
        System.out.println("不带参数的构造方法！！！");
    }
    public Student(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("带两个参数的构造方法！！！");
    }
}
public class Test{
    public static void main(String[] args) {
        Student stu1 = new Student();
        stu1.name = "张三";
        stu1.age = 18;
        stu1.doClass();
        stu1.print();
        Student stu2 = new Student("lisi",28);
        stu2.doClass();
        stu2.print();

    }
}
